using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class JobSeekers_resumes : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session.Contents["jsuserid"] == null)
        {
            Response.Redirect("login.aspx");
        }
        else
        {
            if (!IsPostBack)
            {
                Session["ResumeStatus"] = "Update";
                ShowResume();
            }
        }
    }

    protected void btnNew_Click(object sender, EventArgs e)
    {
        Session["ResumeStatus"] = "New";
        Response.Redirect("resume.aspx");
    }
    protected void btnNext_Click(object sender, EventArgs e)
    {
        Response.Redirect("thankyou.aspx");
    }
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        DeleteResume();
        ShowResume();
    }
    void ShowResume()
    {
        SQLServerProviders cls = new SQLServerProviders();
        DataTable dataTable = cls.GetDataTable(
        "select * " +
        "  from tblJSResumes" +
        " where UserID='" + Convert.ToString(
        Session.Contents["jsuserid"])
        + "'", CommandType.Text);
        GridView1.DataSource = dataTable;
        GridView1.DataBind();
    }
    void DeleteResume()
    {
        string resumeID = "";
        foreach (GridViewRow item in GridView1.Rows)
        {
            CheckBox checkBox = (CheckBox)item.Cells[0].FindControl("chkResumeID");
            if (checkBox.Checked)
                resumeID += item.Cells[0].Text + ",";
        }
        if (resumeID != "")
        {
            SQLServerProviders cls = new SQLServerProviders();
            cls.ExecuteNonQuery(
            "delete  from tblJSResumes" +
            " where UserID='" + Convert.ToString(
            Session.Contents["jsuserid"])
            + "' and resumeID in('" +
            resumeID.Replace(",", "','") + "')",
            CommandType.Text);
        }
    }
}
